<template>
	<div>
		<el-container>
			<el-header style="background-color: #4a4c5b;">
				<el-row style="margin:10px 10px;">
						<el-col :span="1/2" class="juZhong"> <img src="../../assets/icon/logo.png"></el-col>
						<el-col :span="3" class="juZhong"> <span style="font-size: 25px;color: #FFFFFF;white-space: nowrap;"><b>新职通企业版</b></span></el-col>
						<el-col :span="20">
							<div style="float:right;">
								<el-col :span="1/2" class="juZhong">
									<img
										style="width: 40px; height: 40px;border-radius:50%;"
										:src="gongSiImg"
									>
								</el-col>
								<el-col :span="5" > 
									<el-dropdown @command="handleCommand" class="pointer">
										<span style="font-size: 25px;margin-left: 20px;white-space: nowrap;overflow: hidden;color: #FFFFFF;">
											{{gongSiMing}}<i class="el-icon-arrow-down el-icon--right"></i>
										</span>
										<el-dropdown-menu slot="dropdown">
												<el-dropdown-item command="a"><span style="margin-right:10px;color:#E6A23C;font-style:oblique;">V</span><span>会员中心</span></el-dropdown-item>
												<el-dropdown-item command="b"><i class="el-icon-user-solid" style="color:#409EFF"></i><span>修改密码</span></el-dropdown-item>
												<el-dropdown-item command="c"><i class="el-icon-switch-button" style="color:#F56C6C"></i><span>退出登录</span></el-dropdown-item>	
										</el-dropdown-menu>
									</el-dropdown>
								</el-col>
							</div>
						</el-col>
				</el-row>
			</el-header>
			<el-container>
				<el-aside style="width:200px;text-align: center;overflow-x:hidden;">
					<el-menu :default-active="$route.path" style="width: 100%;" id="homeMenu" router>
						<el-menu-item index="/companyPage/home/selfinfo">
							<i class="iconfont icon-shouye" style="font-size: 25px;"></i>
							<span slot="title" style="font-size:18px">登录首页</span>
						</el-menu-item>
						<el-submenu index="2" >
                                <template slot="title">
                                    <i class="iconfont icon-zhaopin" style="font-size: 25px;"></i>
                                    <span  style="font-size:18px">招聘管理</span>
                                </template>
                                <el-menu-item-group>
                                    <el-menu-item index="/companyPage/home/showPost">
                                        <span slot="title">查看招聘</span>
                                    </el-menu-item>
                                    <el-menu-item index="/companyPage/home/newPost">
                                        <span slot="title" >新增招聘</span>
                                    </el-menu-item>
                                </el-menu-item-group>
                        </el-submenu>
						<el-submenu index="3" >
                                <template slot="title">
                                    <i class="iconfont icon-if__" style="font-size: 25px;"></i>
                                    <span  style="font-size:18px">委培管理</span>
                                </template>
                                <el-menu-item-group>
                                    <el-menu-item index="/companyPage/home/showConsign">
                                        <span slot="title">查看委培</span>
                                    </el-menu-item>
                                    <el-menu-item index="/companyPage/home/newConsign">
                                        <span slot="title" >新增委培</span>
                                    </el-menu-item>
                                </el-menu-item-group>
                        </el-submenu>
						<el-submenu index="4" >
                                <template slot="title">
                                    <i class="iconfont icon-xinfeng" style="font-size: 25px;"></i>
                                    <span  style="font-size:18px">消息管理</span>
                                </template>
                                <el-menu-item-group>
                                    <el-menu-item index="/companyPage/home/systemMessage">
                                        <span slot="title">系统消息</span>
                                    </el-menu-item>
                                    <el-menu-item index="/companyPage/home/newsBack">
                                        <span slot="title" >消息反馈</span>
                                    </el-menu-item>
                                </el-menu-item-group>
                        </el-submenu>
					</el-menu>
				</el-aside>
				<el-main style="padding-top:0;background-color: #efefef;">
					<router-view></router-view>
				</el-main>
			</el-container>
			
		</el-container>
	</div>
</template>

<script>
import gongSiImg from '../../assets/t4.jpg'
	export default {
		data(){
			return{
				gongSiImg:gongSiImg,
				gongSiMing:'润实科技',
			}
		},
		mounted(){
			var body=document.getElementById('homeMenu');
			var height=document.documentElement.clientHeight-60;
			body.style.height=height+'px';
			console.log(height);

			this.getNickname();
		},
		methods:{
			getNickname(){
				var URL='http://47.101.180.43:8075/user/getNickname'
                        this.$ajax({
                        method:'get',
                        url:URL,
                    }).then(response =>{
                        var code=0;
                        code=response.data.code;
                        if(code==0){
							this.gongSiMing=response.data.data;
                            console.log(this.gongSiMing); 
                        }else{
                            console.log(response.data.msg); 
                            this.$notify.error({
                                message:response.data.msg
                            });
                        }
                    }).catch(error => {
                    console.log('企业名获取失败');
                    });
			},
			handleCommand(command){
				if(command=='a'){
					console.log('会员');
				}else if(command=='b'){
					this.$router.push({
                        path:'/companyPage/change',
                    }) 
				}else{
					this.$router.push({
                        path:'/',
                    }) 
				}
			},
		},
	}
</script>

<style>

	.pointer{
		cursor: pointer;
	}
	.juZhong{
		display:flex;
		align-items:center;
		justify-content:center
	}
	.selfaside .el-menu-item,
	.el-submenu__title {
		font-size: 18px !important;
		
	}

	.selfaside .el-menu-item {
		color: #909090;
	}

	.selfaside .el-menu-item i {
		color: #909090;
	}

	.selfaside .el-menu-item.is-active i {
		color: #409EFF;
	}

	.selfaside .el-menu-item.is-active {
		color: #409EFF;
	}
</style>
